<template>
	<div id="basicInformation">
		<el-row style="line-height: 40px">
			<el-col :span="4" class="backgroundTitelBox">
				{{ $t('agent.basic_info') }}
			</el-col>
			<el-col :span="2" class="refrestBox">
				<el-button
					type="primary"
					icon="el-icon-refresh"
					@click="refresh"
				>
					{{ $t('common.refresh') }}
				</el-button>
			</el-col>
			<el-col :span="2" class="editMsg">
				<i class="el-icon-edit-outline"></i>
				<br />
				{{ $t('agent.edit_info') }}
			</el-col>
			<el-col :span="16" class="btngroup">
				<el-button
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							hasPermission('201022')
					"
					type="primary"
					@click="editFn($t('common.account_status'))"
				>
					{{ $t('common.account_status') }}
				</el-button>
				<!-- <el-button
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							hasPermission('201023')
					"
					type="primary"
					@click="editFn($t('common.risk_control_level'))"
				>
					{{ $t('common.risk_control_level') }}
				</el-button> -->
				<!-- <el-button
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							hasPermission('201024')
					"
					type="primary"
					@click="editFn($t('agent.agent_label'))"
				>
					{{ $t('agent.agent_label') }}
				</el-button> -->
				<!-- c -->
				<el-button
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							hasPermission('201026')
					"
					type="primary"
					:disabled="examineFlag.includes(1)"
					@click="editFn($t('agent.pay_password_reset'))"
				>
					{{ $t('agent.pay_password_reset') }}
				</el-button>
				<!-- 二期注释 强制编辑契约生效 -->
				<!-- <el-button
					v-if="outlineInfoList.entryAuthority !== 0 && hasPermission('201027')"
					type="primary"
					@click="editFn($t('agent.forced_edit_contract_effect'))"
				>
					{{ $t('agent.forced_edit_contract_effect') }}
				</el-button> -->
				<!-- TODO -->
				<!-- :disabled="outlineInfoList.isTransformMember" -->
				<el-button
					v-if="
						outlineInfoList.entryAuthority === 0 &&
							hasPermission('201039')
					"
					type="primary"
					@click="handleOpenAddOpenProxyAudit()"
				>
					{{ $t('agent.entrance_role') }}
				</el-button>
				<span
					v-if="
						outlineInfoList.entryAuthority === 0 &&
							hasPermission('201039')
					"
					class="redColor"
				>
					{{
						outlineInfoList.isTransformMember
							? '该代理入口权限待处理'
							: $t('agent.rule_entry_role_tip2')
					}}
				</span>
				<el-button
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							hasPermission('201028')
					"
					type="primary"
					@click="editFn($t('agent.credit_level'))"
				>
					{{ $t('agent.credit_level') }}
				</el-button>
				<el-button
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							outlineInfoList.proxyLevel === 0 &&
							hasPermission('201029')
					"
					type="primary"
					@click="editFn($t('agent.agent_level_limit'))"
				>
					{{ $t('agent.agent_level_limit') }}
				</el-button>
				<!-- 契约政策调整 -->
				<!-- <span
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							outlineInfoList.proxyLevel === 0 &&
							getContractTypeArr().length
					"
				>
					<el-dropdown
						v-if="getContractTypeArr().length === 2 && hasPermission('201033')"
						trigger="click"
						@command="handleCommand"
					>
						<el-button type="primary">
							{{ $t('agent.contract_policy_adjust') }}
						</el-button>
						<el-dropdown-menu slot="dropdown">
							<el-dropdown-item
								v-for="item in getContractTypeArr()"
								:key="item.value"
								:command="item.value"
							>
								{{ item.title }}
							</el-dropdown-item>
						</el-dropdown-menu>
					</el-dropdown>
					<template v-else>
						<el-button
							v-if="hasPermission('201033')"
							type="primary"
							@click="openPolicyTypeDialog(getContractTypeArr()[0].value)"
						>
							{{ $t('agent.contract_policy_adjust') }}
						</el-button>
					</template>
				</span> -->
				<el-button
					v-if="
						outlineInfoList.entryAuthority !== 0 &&
							hasPermission('201048')
					"
					type="primary"
					:disabled="examineFlag.includes(2)"
					@click="editFn($t('member.login_password_reset'))"
				>
					{{ $t('member.login_password_reset') }}
				</el-button>

				<!-- <el-button
					v-if="outlineInfoList.proxyLevel === 0"
					type="primary"
					@click="withdrawDialog.visible = true"
				>
					取款限制
				</el-button> -->

				<el-button
					v-if="outlineInfoList.proxyLevel === 0"
					type="primary"
					@click="editFn($t('routes.system.manage'))"
				>
					权限管理
				</el-button>
				<el-button
					v-if="
						outlineInfoList.proxyLevel === 0 &&
							monthBalanceDialog.balanceToCleared > 0
					"
					type="primary"
					@click="monthBalance()"
				>
					上月结余清除
				</el-button>
				<el-button
					v-if="
						outlineInfoList.entryAuthority === 1 &&
							hasPermission('90750046') &&
							outlineInfoList.businessModel === 2
					"
					type="primary"
					@click="textVisible = true"
				>
					{{ $t('agent.oneKey_received_credit_limit') }}
				</el-button>
				<el-button
					v-if="
						outlineInfoList.entryAuthority === 1 &&
							hasPermission('90750094') &&
							outlineInfoList.businessModel === 2
					"
					type="primary"
					@click="recycleLimitVisible = true"
				>
					{{ $t('agent.recycle_available_limit') }}
				</el-button>
				<el-button
					v-if="hasPermission('90930045')"
					type="primary"
					@click="editFn($t('agent.check_title'))"
				>
					安全校验
				</el-button>
				<el-button
					v-if="
						outlineInfoList.entryAuthority === 1 &&
							hasPermission('90900064') &&
							outlineInfoList.proxyLevel === 0
					"
					type="primary"
					@click="editFn($t('agent.top_proxy_belong'))"
				>
					{{ $t('agent.top_proxy_belong') }}
				</el-button>
				<el-button
					v-if="hasPermission('90930062') && outlineInfoList.proxyLevel === 0"
					type="primary"
					@click="editFn($t('agent.proxyGroup'))"
				>
					总代分组
				</el-button>
			</el-col>
		</el-row>
		<div class="titelBox">{{ $t('agent.summary_info') }}</div>
		<el-row class="msgList">
			<el-col :span="6">
				{{ $t('agent.agent_account') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>{{ outlineInfoList.userName || '-' }}</span>
			</el-col>
			<el-col :span="6">
				{{ $t('common.number_type') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ typeFilter(outlineInfoList.accountType, 'accountType') }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('common.account_status') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					<!-- 清算逻辑 -->
					<span
						v-if="
							outlineInfoList.liquidationStatus === 1 ||
								outlineInfoList.liquidationStatus === 2
						"
						class="disableRgba"
					>
						{{ $t('common.liquidation_completed') }}
					</span>
					<span v-else>
						<span
							v-if="outlineInfoList.loginLockStatus === 1"
							class="disableRgba"
						>
							{{ $t('agent.login_lock') }}
						</span>
						<span
							v-if="outlineInfoList.paymentLockStatus === 1"
							class="deleteRgba"
						>
							{{ $t('agent.charge_lock') }}
						</span>
						<span
							v-if="
								outlineInfoList.loginLockStatus === 0 &&
									outlineInfoList.paymentLockStatus === 0
							"
							class="normalRgba"
						>
							{{ $t('agent.normal') }}
						</span>
					</span>
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('common.belong_merchant') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.merchantName || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.agent_level') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					<strong v-if="outlineInfoList.entryAuthority === 0">
						-
					</strong>
					<strong v-else>
						{{
							(outlineInfoList.proxyLevel === 0
								? '0'
								: outlineInfoList.proxyLevel) || '-'
						}}
					</strong>
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.level_name') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					<strong v-if="outlineInfoList.entryAuthority === 0">
						-
					</strong>
					<strong v-else>
						{{ outlineInfoList.proxyLevelName || '-' }}
					</strong>
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('common.direct_superior') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					<strong v-if="outlineInfoList.entryAuthority === 0">
						-
					</strong>
					<strong v-else>
						{{ outlineInfoList.parentProxyName || '-' }}
					</strong>
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.total_agent_account') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					<strong v-if="outlineInfoList.entryAuthority === 0">
						-
					</strong>
					<strong v-else>
						{{ outlineInfoList.topProxyName || '-' }}
					</strong>
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.agent_level_limit') }}:
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.maxLevel || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('common.business_model') }}:
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{
						mappingBusinessModel(outlineInfoList.businessModel) ||
							'-'
					}}
				</span>
			</el-col>
			<el-col :span="6">
				总代分组:
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{
						outlineInfoList.groupName ||
							'-'
					}}
				</span>
			</el-col>
			<!-- <el-col :span="6">
				{{ $t('agent.agent_label') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.labelName || '-' }}
				</span>
			</el-col> -->

			<el-col :span="6">
				{{ $t('agent.jv_code') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.joinCode || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.credit_level') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{
						outlineInfoList.creditLevel === null
							? '-'
							: outlineInfoList.creditLevel
					}}
				</span>
			</el-col>

			<el-col :span="6">
				{{ $t('common.register_time') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.createdAt || '-' }}
				</span>
			</el-col>
			<!-- <el-col :span="6">
				{{ $t('common.risk_control_level') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.windControlName || '-' }}
				</span>
			</el-col> -->
			<el-col :span="6">
				{{ $t('agent.register_device') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{
						typeFilter(
							outlineInfoList.registerDeviceType,
							'deviceType'
						)
					}}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.register_ip') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.registerIp }}
				</span>
				<span
					v-if="
						outlineInfoList.registerIpWindControl !== '' &&
							outlineInfoList.registerIpWindControl !== null
					"
					class="redColor"
				>
					({{ $t('common.risk_control_level') }}：{{
						outlineInfoList.registerIpWindControl
					}})
				</span>
				<span v-else class="redColor">
					({{ $t('common.risk_control_level') }}：{{
						$t('agent.none')
					}})
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.last_login_time') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.lastLoginDatetime || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.offline_days') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ handelDayNum(outlineInfoList.lastLoginDatetime)
					}}{{ $t('agent.day') }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.entrance_role') }}：
				<i v-if="activeL" class="el-icon-loading"></i>

				<span
					v-else-if="outlineInfoList.entryAuthority == 0"
					class="redColor"
				>
					{{
						typeFilter(
							outlineInfoList.entryAuthority,
							'entrAuthorityType'
						)
					}}
				</span>
				<span v-else>
					{{
						typeFilter(
							outlineInfoList.entryAuthority,
							'entrAuthorityType'
						)
					}}
				</span>
			</el-col>
			<el-col :span="6">
				安全校验：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ checkTypeStr }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.top_proxy_belong') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.proxyAffiliation || '-' }}
				</span>
			</el-col>
			<!-- <el-col :span="6">
				{{ $t('agent.forced_edit_contract_effect') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span
					v-else
					:class="outlineInfoList.enforceContractStatus === 0 ? 'redColor' : ''"
				>
					{{
						outlineInfoList.enforceContractStatus === 1
							? $t('common.turn_on')
							: outlineInfoList.enforceContractStatus === 0
							? $t('agent.close')
							: '-'
					}}
				</span>
			</el-col> -->
		</el-row>
		<el-divider></el-divider>
		<!-- <div class="titelBox">{{ $t('agent.personal_info') }}</div>
		<el-row class="msgList">
			<el-col :span="6">
				{{ $t('common.name') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.realName || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.gender') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ typeFilter(outlineInfoList.gender, 'genderType') }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.birthdate') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.birthday || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.phone_number') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.mobile || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.email') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.email || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				QQ：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.qq || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				flygram：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else>
					{{ outlineInfoList.flygram || '-' }}
				</span>
			</el-col>
			<el-col :span="6">
				{{ $t('agent.pay_password') }}：
				<i v-if="activeL" class="el-icon-loading"></i>
				<span v-else-if="examineFlag.includes(1)" class="orangeColor">
					{{ $t('agent.rest_password') }} &nbsp;&nbsp;
					{{ $t('agent.auditing') }}
				</span>
				<span v-else>
					{{ outlineInfoList.payPassword || '-' }}
				</span>
			</el-col>
		</el-row>
		<el-divider></el-divider> -->
		<div class="titelBox">{{ $t('agent.remark_info') }}</div>
		<div
			v-if="activeL"
			style="
				height: 100px;
				width: 300px;
				line-height: 100px;
				text-align: center;
				font-size: 24px;
			"
		>
			<i class="el-icon-loading"></i>
		</div>
		<div v-else style="width: 100%">
			<el-table
				border
				size="mini"
				class="small-size-table"
				:data="tableList"
				:header-row-style="{ height: '24px', lineHeight: '24px' }"
				style="margin-top: 10px; z-index: 0"
				:header-cell-style="getRowClass"
				highlight-current-row
			>
				<el-table-column
					align="center"
					type="index"
					:label="$t('common.serial_number')"
				></el-table-column>
				<el-table-column
					prop="createDt"
					align="center"
					:label="$t('agent.update_time')"
				>
					<template slot-scope="scope">
						<span>{{ scope.row.createdAt || '-' }}</span>
					</template>
				</el-table-column>
				<el-table-column
					prop="remark"
					align="center"
					:label="$t('agent.remark_info')"
					show-overflow-tooltip
				>
					<template slot-scope="scope">
						<span>{{ scope.row.remark || '-' }}</span>
					</template>
				</el-table-column>
				<el-table-column
					prop="operator"
					align="center"
					:label="$t('agent.remark_account')"
				>
					<template slot-scope="scope">
						<span>{{ scope.row.operator || '-' }}</span>
					</template>
				</el-table-column>
			</el-table>
			<!-- 分页 -->
			<el-pagination
				:current-page.sync="page"
				background
				layout="total, sizes,prev, pager, next, jumper"
				:page-size="size"
				:page-sizes="$store.getters.pageSizes"
				:total="total"
				:pager-count="9"
				style="float: right; padding-top: 10px"
				@current-change="handleCurrentChange"
				@size-change="handleSizeChange"
			></el-pagination>
			<div class="clear"></div>
		</div>

		<el-dialog
			:title="moduleBox"
			:visible.sync="editVisible"
			:before-close="closeFormDialog"
			:width="isShowRemark ? '620px' : '420px'"
		>
			<el-form
				ref="editForm"
				:model="editData"
				label-width="auto"
				@submit.native.prevent="enterSearch"
			>
				<AgenGroupSelect v-if="moduleBox === $t('agent.proxyGroup')"  v-model="editData.groupId" />
				<el-form-item
					v-if="moduleBox === $t('common.account_status')"
					:label="$t('common.account_status') + ':'"
					prop="code"
				>
					{{ $t('agent.login_lock') }}:
					<el-switch
						v-model="loginLockStatus"
						:inactive-value="0"
						:active-value="1"
					></el-switch>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					{{ $t('agent.charge_lock') }}:
					<el-switch
						:disabled="
							outlineInfoList.liquidationStatus === 1 ||
								outlineInfoList.liquidationStatus === 2
						"
						v-model="paymentLockStatus"
						:inactive-value="0"
						:active-value="1"
					></el-switch>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<!-- {{ $t('agent.liquidation') }}:
					<el-switch
						v-model="liquidation"
						@change="liquidationFn"
						:disabled="
							outlineInfoList.liquidationStatus === 1 ||
								outlineInfoList.liquidationStatus === 2 || !hasPermission('90750046')
						"
						:inactive-value="0"
						:active-value="1"
					></el-switch> -->
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('common.risk_control_level')"
					:label="$t('common.risk_control_level') + '：'"
					prop="windControlId"
					:rules="[
						{
							required: true,
							message: $t('agent.rule_select_tip_win_level'),
							trigger: 'blur'
						}
					]"
				>
					<el-select
						v-model="editData.windControlId"
						:placeholder="$t('common.please_choose')"
						@change="changeWindControlId"
					>
						<el-option
							v-for="item in riskLevelList"
							:key="item.id"
							:label="item.windControlLevelName"
							:value="item.id"
						></el-option>
					</el-select>
				</el-form-item>
				<!-- 安全校验 -->
				<GoogleKeySelect
					:isShowBtn="outlineInfoList.checkType === 1 && editData.checkType == 1"
					 v-model="editData.checkType"
					v-if="moduleBox === $t('agent.check_title')"
					prop="checkType"
					@click="() => handleResetKey(true)"  />
				<el-form-item
					v-if="moduleBox === $t('agent.agent_label')"
					:label="$t('agent.agent_label') + '：'"
					prop="labelId"
					:rules="[
						{
							required: true,
							message: $t('agent.rule_select_tip_agent_label'),
							trigger: 'change'
						}
					]"
				>
					<el-select
						v-model="editData.labelId"
						:placeholder="$t('common.please_choose')"
						@change="changeLabelId"
					>
						<el-option
							v-for="item in memberLabelList"
							:key="item.id"
							:label="item.labelName"
							:value="item.id"
						></el-option>
					</el-select>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('agent.entrance_role')"
					:label="$t('agent.entrance_role') + ':'"
					prop="code"
				>
					<el-select
						v-model="editData.entryAuthority"
						:placeholder="$t('common.please_choose')"
						disabled
						@change="changeEntrAuthorityType"
					>
						<el-option
							v-for="item in entrAuthorityType"
							:key="item.description"
							:label="item.description"
							:value="item.code"
						></el-option>
					</el-select>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('agent.entrance_role')"
					:label="$t('common.direct_superior') + '：'"
					prop="parentProxyName"
					:rules="[
						{
							required: true,
							message: $t('agent.rule_input_up_account'),
							trigger: 'blur'
						}
					]"
				>
					<el-input
						v-model="editData.parentProxyName"
						maxlength="11"
						:placeholder="$t('agent.rule_input_tip_bind')"
					></el-input>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('agent.pay_password_reset')"
					:label="$t('agent.pay_password_reset') + '：'"
					prop="pws"
				>
					<el-input
						:placeholder="$t('agent.rest_password')"
						disabled
					></el-input>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('agent.forced_edit_contract_effect')"
					:label="$t('agent.forced_edit_contract_effect') + ':'"
					prop="mandatoryContract"
				>
					<el-select
						v-model="editData.mandatoryContract"
						:placeholder="$t('common.please_choose')"
						@change="changeLabelId"
					>
						<el-option
							v-for="item in entrAuthorityType"
							:key="item.description"
							:label="item.description"
							:value="item.code"
						></el-option>
					</el-select>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('agent.credit_level')"
					:label="$t('agent.credit_level') + ':'"
					prop="creditLevel"
				>
					<el-select
						v-model="editData.creditLevel"
						:placeholder="$t('common.please_choose')"
					>
						<el-option
							v-for="item in creditLevelList"
							:key="item"
							:label="item"
							:value="item"
						></el-option>
					</el-select>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('agent.agent_level_limit')"
					:label="$t('agent.agent_level_limit') + ':'"
					prop="proxyLevel"
				>
					<el-select
						v-model="editData.maxLevel"
						:placeholder="$t('common.please_choose')"
					>
						<el-option
							v-for="item in proxyLevelList"
							:key="item.id"
							:label="item.id"
							:value="item.id"
						></el-option>
					</el-select>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('member.login_password_reset')"
					label=""
				>
					<div style="line-height:20px">
						{{ $t('member.reset_succeeded_password') }}
						<span style="color:#1990ff">
							{{ resetPassword }}
						</span>
						<i
							class="el-icon-document-copy"
							@click="copy(resetPassword)"
						/>
						<br />
						{{ $t('member.reset_succeeded_password_tip') }}
					</div>
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('agent.profit_policy_adjust')"
					:label="$t('agent.profit_policy_adjust') + ':'"
					prop="sharingPolicyId"
					:rules="[
						{
							required: true,
							message: this.$t(
								'agent.rule_select_tip_policy_type'
							),
							trigger: 'change'
						}
					]"
				>
					<el-select
						v-model="editData.sharingPolicyId"
						:placeholder="$t('common.please_choose')"
					>
						<el-option
							v-for="item in profitSharingList"
							:key="item.id"
							:label="item.policyType"
							:value="item.id"
						></el-option>
					</el-select>
				</el-form-item>
				<el-form-item
					:label="titel"
					v-if="isShowRemark"
					prop="remark"
					:class="
						moduleBox === $t('agent.forced_edit_contract_effect')
							? 'maxWidth'
							: ''
					"
					:rules="[
						{
							required: true,
							message: $t('agent.rule_input_tip_remark'),
							trigger: 'blur'
						},
						{
							min: 2,
							max: 500,
							message: $t('agent.rule_length_tip2-500'),
							trigger: 'blur'
						}
					]"
				>
					<el-input
						v-model="editData.remark"
						:maxlength="500"
						show-word-limit
						type="textarea"
						:placeholder="$t('common.please_enter')"
					></el-input>
				</el-form-item>

				<!-- 权限管理 -->
				<el-form-item
					v-if="moduleBox === $t('routes.system.manage')"
					label="开通直属会员代理权限"
				>
					<el-switch v-model="editData.playerToProxy" />
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('routes.system.manage')"
					label="跨级操作权限"
				>
					<el-switch v-model="editData.crossOptLevel" />
				</el-form-item>
				<el-form-item
					v-if="moduleBox === $t('routes.system.manage')"
					label="流水倍数配置权限"
				>
					<el-switch v-model="editData.rolloverMultipleConfig" />
				</el-form-item>
				<!-- 权限管理End -->
				<!--总代所属-->
				<el-form-item
					v-if="moduleBox === $t('agent.edit_top_proxy_belong')"
					:label="$t('agent.top_proxy_belong')"
				>
					<el-input
						v-model="editData.proxyAffiliation"
						clearable
						type="text"
						:maxlength="11"
						v-input="{name: 'onlyInputNumZh'}"
						:placeholder="$t('common.please_enter')"
					></el-input>
				</el-form-item>
			</el-form>
			<span
				v-if="moduleBox === $t('agent.entrance_role')"
				style="color: #999"
			>
				申请开启代理入口权限后，同名会员将同步申请转至代理名下。请在【开启代理入口审核】页面审核通过后，开启代理入口权限成功。
			</span>
			<div slot="footer" class="dialog-footer">
				<el-button @click="closeFormDialog">
					{{ $t('agent.cancel') }}
				</el-button>
				<el-button type="primary" @click="submitEdit">
					{{ $t('common.sure') }}
				</el-button>
			</div>
		</el-dialog>
		<!-- 契约政策调整弹窗 -->
		<el-dialog
			v-if="policyTypeDialog.visible"
			:visible.sync="policyTypeDialog.visible"
			width="1300px"
			:show-close="false"
			:close-on-click-modal="false"
			:destroy-on-close="true"
			class="policy-type-dialog"
		>
			<template slot="title">
				<span style="color:#fff">{{ $t('agent.policy_edit') }}</span>
				<el-button
					:disabled="loading"
					size="medium"
					@click="onContractEditOrCreateDialogClose"
				>
					{{ $t('agent.close') }}
				</el-button>
			</template>
			<ContractEditOrCreate
				:edit-data="policyTypeDialog.editData"
				:page-type="2"
				:is-edit="true"
				@goback="onContractEditOrCreateDialogClose"
			></ContractEditOrCreate>
		</el-dialog>

		<!--  0.2.1 -->
		<!-- 取款限制类型 -->
		<!-- <el-dialog
			width="400px"
			:visible.sync="withdrawDialog.visible"
			:show-close="false"
			:close-on-click-modal="false"
			:destroy-on-close="true"
			:title="withdrawDialog.title"
		>
			<div class="withdraw">
				<div class="info">
					设置成功后，该代理及其下级所有下级代理和所有全部会员均调整为最新取款限制类型。
				</div>
				<el-form class="withdraw-form">
					<div>
						<el-radio
							v-model="withdrawDialog.withdrawLimitType"
							:label="1"
						>
							账单限制
							<p>取款时受到最新账单的“可提现金额”限制。</p>
						</el-radio>
					</div>
					<div>
						<el-radio
							v-model="withdrawDialog.withdrawLimitType"
							:label="2"
						>
							流水限制
							<p>取款时受到“所需有效流水”限制。</p>
						</el-radio>
					</div>
				</el-form>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button @click="withdrawDialog.visible = false">
					{{ $t('agent.cancel') }}
				</el-button>
				<el-button
					:loading="loading"
					type="primary"
					@click="handleEditWithdrawLimitType"
				>
					{{ $t('common.sure') }}
				</el-button>
			</div>
		</el-dialog> -->

		<!-- 1.5 上月结清余额 -->
		<el-dialog
			width="550px"
			:visible.sync="monthBalanceDialog.visible"
			:show-close="false"
			:close-on-click-modal="false"
			:destroy-on-close="true"
			:title="monthBalanceDialog.title"
		>
			<el-form
				ref="monthBalanceForm"
				:model="monthBalanceDialog"
				label-width="auto"
			>
				<el-form-item :required="true" label="待清除结余：">
					<span style="color:red">
						{{
							handleNumber(
								outlineInfo.currency,
								monthBalanceDialog.balanceToCleared
							)
						}}
					</span>
				</el-form-item>
				<el-form-item
					label="备注："
					:required="true"
					prop="remark"
					:rules="[
						{
							required: true,
							message: this.$t(
								'funds.fund_audit.form_rules_tip2'
							),
							trigger: 'blur'
						},
						{
							min: 2,
							max: 500,
							message: this.$t(
								'funds.fund_audit.form_rules_tip2'
							),
							trigger: 'blur'
						}
					]"
				>
					<el-input
						v-model="monthBalanceDialog.remark"
						clearable
						type="textarea"
						:maxlength="500"
						show-word-limit
						:autosize="{ minRows: 4, maxRows: 4 }"
						style="width: 280px"
						:placeholder="$t('common.please_enter')"
					></el-input>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="monthBalanceDialog.visible = false">
					{{ $t('agent.cancel') }}
				</el-button>
				<el-button
					:loading="loading"
					type="primary"
					@click="monthBalance(true)"
				>
					{{ $t('common.sure') }}
				</el-button>
			</div>
		</el-dialog>

		<el-dialog
			width="300px"
			:visible="!!eventId"
			:show-close="false"
			:close-on-click-modal="false"
			:destroy-on-close="true"
			title="申请开启入口权限提交成功"
		>
			<p>
				审核号：
				<a class="el-link el-link--primary" @click="goOpenProxyReview">
					{{ eventId }}
				</a>
				等待审核结果
			</p>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="eventId = undefined">
					返回
				</el-button>
			</div>
		</el-dialog>
		<el-divider></el-divider>
		<!-- 回收全部额度 -->
		<el-dialog
			width="650px"
			:visible.sync="textVisible"
			:show-close="true"
			:close-on-click-modal="true"
			@close="liquidation = false"
			:destroy-on-close="true"
			:title="'确认回收全部额度'"
		>
			<div>
				<div v-if="outlineInfoList.proxyLevel === 0" class="textContent">
					<p class="mb10">
						当<strong>总代线</strong>因各类问题需要关停清算时，可以使用此功能快速<strong>回收下发的信用额度和平账</strong>
					</p>
					<p class="mb10">
						为了保证回收信用额度的准确性和及时性，我们将对：
					</p>
					<p class="mb10">
						1.被关停回收的代理及旗下全部账号没有<strong>未结算注单</strong>和<strong>进行中的德州牌桌</strong>后才能进行回收操作
					</p>
					<p class="mb10">
						2.被关停回收的代理及旗下全部账号<strong>充提锁定和游戏锁定</strong>，防止回收后产生新的资金变动
					</p>
					<p class="mb10">
						3.被关停回收的代理及旗下全部账号的<strong>授信额度和现金余额都会回到总代账户；同时总代将继承下级的欠款，并强制使用信用额度帮下级还款冲正</strong>
					</p>
					<p class="mb10">
						4.被关停的账号还可登录平台查看账单进行交收；平台将提供给一份清算账单，作为交收的依据；<strong>清算账单</strong>你可以在中控后台-代理-代理管理栏目中查看
					</p>
					<p class="mb10 pl10">交收说明：</p>
					<p class="mb10 pl10">
						①总代团队净资产为负，表示亏损，需上交平台
					</p>
					<p class="mb10 pl10">
						②总代团队净资产为正，表示盈利，平台需支付总代
					</p>
					<p class="mb10 pl10">
						③总代团队净资产为零，表示持平，无需交收
					</p>
					<p class="mb10">
						5.回收后因以下异常情况会产生新的资金变动导致交收存在误差，建议您重新操作一次额度回收
					</p>
					<p class="mb10 pl10">①已结算的注单在回收后产生了二次结算</p>
					<p class="mb10 pl10">②回收后平台发放的返水</p>
					<p class="mb10 pl10">③其他</p>
					<p class="mb10"><strong>注意：</strong></p>
					<p class="mb10"><strong>1.每次操作不可撤销，请确认无误后再使用</strong></p>
					<p class="mb10"><strong>2.操作后系统需要一定的处理时间，请耐心等待</strong></p>
				</div>
				<div v-else class="textContent">
					<p class="mb10">
						当代理线因各类问题需要关停清算时，可以使用此功能快速<strong>回收下发的信用额度和平账</strong>
					</p>
					<p class="mb10">
						为了保证回收信用额度的准确性和及时性，我们将对：
					</p>
					<p class="mb10">
						1.被关停回收的代理及旗下全部账号没有<strong>未结算注单</strong>和<strong>进行中的德州牌桌</strong>后才能进行回收操作
					</p>
					<p class="mb10">
						2.被关停回收的代理及旗下全部账号<strong>充提锁定和游戏锁定</strong>，防止回收后产生新的资金变动
					</p>
					<p class="mb10">
						3.被关停回收的代理及旗下全部账号的<strong>授信额度和现金余额都会回到被操作代理的上级账户；同时上级将继承被操作代理团队的欠款，并强制使用信用额度帮下级还款冲正</strong>
					</p>
					<p class="mb10">
						4.被关停的账号还可登录平台查看账单进行交收；平台将提供给一份<strong>清算账单</strong>，作为交收的依据；清算账单你可以在中控后台-代理-代理管理栏目中查看
					</p>
					<p class="mb10 pl10">交收说明：</p>
					<p class="mb10 pl10">
						①被操作代理团队净资产为负，表示亏损，需上交上级
					</p>
					<p class="mb10 pl10">
						②被操作代理团队净资产为正，表示盈利，需收款上级
					</p>
					<p class="mb10 pl10">
						③被操作代理团队净资产为零，表示持平，无需交收
					</p>
					<p class="mb10">
						5.回收后因以下异常情况会产生新的资金变动导致交收存在误差，建议您重新操作一次额度回收
					</p>
					<p class="mb10 pl10">①已结算的注单在回收后产生了二次结算</p>
					<p class="mb10 pl10">②回收后平台发放的返水</p>
					<p class="mb10 pl10">③其他</p>
					<p class="mb10"><strong>注意：</strong></p>
					<p class="mb10"><strong>1.每次操作不可撤销，请确认无误后再使用</strong></p>
					<p class="mb10"><strong>2.操作后系统需要一定的处理时间，请耐心等待</strong></p>
				</div>
				<div slot="footer" class="dialog-footer">
					<el-button type="default" @click="textVisible = false">
						{{ $t('common.cancel') }}
					</el-button>
					<el-button type="primary" @click="oneKeyReceivedCredLimit">
						{{ $t('common.sure') }}
					</el-button>
				</div>
			</div>
		</el-dialog>
		<!-- 回收可用额度 -->
		<el-dialog
			width="650px"
			:visible.sync="recycleLimitVisible"
			:show-close="true"
			:close-on-click-modal="true"
			@close="liquidation = false"
			:destroy-on-close="true"
			:title="'回收可用额度'"
		>
			<div>
				<div class="mb10">
					为了保证平账还款的准确性和及时性，我们将对：
				</div>
				<div class="mb10">
					1.关停代理及旗下的全部代理充提锁定；旗下的全部会员游戏锁定和充提锁定，以减少新的资金变动。
				</div>
				<div class="mb10">
					2.关停账号还可登录平台查看账单/报表进行交收。回收可用额度机制是使用现金余额尽可能多的偿还借款，还款后现金余额为0或应还借款为0。并将可用额度全部回收至最高层级代理。
				</div>
				<div class="mb10">
					3.建议你操作后等待一段时间后再进行交收，因为旗下会员或代理可能还存在以下情况：
				</div>
				<div class="mb10 ml10">①未结体育/电竞注单</div>
				<div class="mb10 ml10">②未结会员返水/未结代理收益</div>
				<div class="mb10 ml10">③被锁定的局服务费</div>
				<div class="mb10 ml10">④其他</div>
				<div class="mb10 redColor">注意：</div>
				<div class="mb10">1.此操作不可撤销，请谨慎处理。</div>
				<div class="mb10">2.此操作需要一定的处理时间，请耐心等待。</div>
				<div class="mb10">3.处理完成后当前代理会收到一条消息通知。</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="default" @click="recycleLimitVisible = false">
					{{ $t('common.cancel') }}
				</el-button>
				<el-button type="primary" @click="recycleCredLimitMethod">
					{{ $t('common.sure') }}
				</el-button>
			</div>
		</el-dialog>
		<GoogleKeyInput
			:isShowdialog="isShowdialog"
			@getGoogleKey="(code) => moduleBox === $t('agent.check_title') ? updateCheckKey(code) : getGoogleKey(code) "
			@backPrevStep="backPrevStep()"
		></GoogleKeyInput>

		<AddOpenProxyAuditDialog
			v-if="addOpenProxyAuditDialog.visible"
			:visible.sync="addOpenProxyAuditDialog.visible"
			:outlineInfo="outlineInfo"
			@success="handleOpenProxyAuditSuccess"
		/>
	</div>
</template>

<script>
import list from '@/mixins/list'
import ContractEditOrCreate from '@/components/ContractEditOrCreate'
import dayjs from 'dayjs'
import AddOpenProxyAuditDialog from './AddOpenProxyAuditDialog'
import AgenGroupSelect from '@/components/AgenGroupSelect'
import GoogleKeySelect from '@/components/GoogleKeySelect'

export default {
	components: {
		GoogleKeySelect,
		ContractEditOrCreate,
		AddOpenProxyAuditDialog,
		AgenGroupSelect,
		GoogleKeyInput: () => import('@/components/GoogleKeyInput')
	},
	mixins: [list],
	props: {
		parentData: { type: Object, default: () => ({}) },
		outlineInfo: { type: Object, default: () => ({}) },
		remarksTableData: { type: Object, default: () => ({}) }
	},
	data() {
		return {
			eventId: undefined, // 入口权限 id
			isShowRemark: true,
			loading: false,
			activeL: false,
			examineFlag: [], // 审核中的按钮状态
			riskLevelList: [], // 风控层级
			memberLabelList: [], // 代理标签
			creditLevelList: [], // 信用等级
			proxyLevelList: [], // 代理层级
			profitSharingList: [], // 分润政策
			outlineInfoList: {}, // 基本信息
			tableList: [],
			moduleBox: '',
			titel: this.$t('agent.submit_remark'),
			editVisible: false,
			loginLockStatus: 0,
			liquidation: 0,
			paymentLockStatus: 0,
			checkTypeStr: '无校验',
			isResetGoogelKey: false,
			editData: {
				parentProxyName: '',
				windControlId: '',
				labelId: '',
				mandatoryContract: '',
				entryAuthority: '1',
				creditLevel: '',
				maxLevel: '',
				sharingPolicyId: '',
				remark: '',
				merchantId: '',
				playerToProxy: false,
				crossOptLevel: false,
				rolloverMultipleConfig: false,
				groupId: undefined,
				checkType: 0,
				proxyAffiliation: ''
			},
			page: 1,
			size: 100,
			commissionContract: [],
			textVisible: false,
			rebateContract: [],
			policyTypeDialog: {
				visible: false,
				editData: Object.assign({}, this.outlineInfoList)
			},
			withdrawDialog: {
				title: '取款限制',
				visible: false,
				withdrawLimitType: 1
			},

			monthBalanceDialog: {
				title: '上月结清余额',
				visible: false,
				// 待结清余额
				balanceToCleared: undefined,
				remark: undefined
			},
			addOpenProxyAuditDialog: {
				visible: false
			},
			isShowdialog: false,
			googleVerifyCode: '',
			disableOneKeyBtn: false,
			recycleLimitVisible: false,
			recycleStatus: undefined
		}
	},
	computed: {
		accountStatusType() {
			return this.globalDics.accountStatusType2 || []
		},
		entrAuthorityType() {
			return this.globalDics.entrAuthorityType || []
		},
		appIdArr() {
			return this.globalDics.appId || []
		}
	},
	watch: {
		parentData: {
			handler() {
				this.refresh()
			},
			deep: true,
			immediate: true
		},
		outlineInfo: {
			handler(newV) {
				this.examineFlag = []
				this.outlineInfoList = { ...newV }
				if (newV.auditList && newV.auditList !== null) {
					for (let i = 0; i < newV.auditList.length; i++) {
						const ele = newV.auditList[i]
						this.examineFlag.push(ele.applyType)
					}
				} else {
					this.examineFlag = []
				}
			},
			deep: true
		},
		remarksTableData: {
			handler(newV) {
				if (newV.totalRecord && newV.totalRecord > 0) {
					this.total = newV.totalRecord
					this.tableList = newV.record
				} else {
					this.total = 0
					this.tableList = []
				}
			},
			deep: true
		}
	},
	created() {
		this.getPolicyTypeArr()
		// this.initGetDics()
	},
	mounted() {},
	methods: {
		handleOpenAddOpenProxyAudit() {
			this.addOpenProxyAuditDialog.visible = true
		},
		handleOpenProxyAuditSuccess(eventId) {
			this.eventId = eventId
		},
		async queryLastMonthBalance() {
			if (this.outlineInfo && this.outlineInfo.topProxyId) {
				const res = await this.$api.queryLastMonthBalance({
					proxyId: this.outlineInfo.topProxyId
				})
				if (res.code === 200) {
					this.monthBalanceDialog.balanceToCleared =
						res.data.balanceToCleared
				}
			}
		},
		async monthBalance(f) {
			// 提交
			if (f) {
				await this.$refs.monthBalanceForm.validate()
				const res = this.$api.clearedLastMonthBalance({
					proxyId: this.outlineInfo.topProxyId,
					remark: this.monthBalanceDialog.remark
				})
				if (res.code === 200) {
					this.monthBalanceDialog.visible = false
				}
			} else {
				const res = await this.$api.queryLastMonthBalance({
					proxyId: this.outlineInfo.topProxyId
				})
				if (res.code === 200) {
					this.monthBalanceDialog.remark = res.data.remark
					this.monthBalanceDialog.balanceToCleared =
						res.data.balanceToCleared
				}
				this.monthBalanceDialog.visible = true
			}
		},
		// liquidationFn(val) {
		// 	if (val) {
		// 		this.textVisible = true
		// 	}
		// },
		// 回收全部额度
		oneKeyReceivedCredLimit() {
			this.recycleStatus = 2
			const data = {
				userName: this.parentData.userName,
				merchantId: this.parentData.merchantId,
				proxyInfoRpcLiquidationReqDTO: {
					liquidationStatus: 1,
					loginLockStatus: 0,
					paymentLockStatus: 0,
					remark: '',
					recycleModel: this.recycleStatus // 回收可用额度: 0, 回收全部额度:  2
				}
			}
			this.$api
				.recoverAllAmountApi(data)
				.then((res) => {
					const { code, data, msg} = res || {}
					if (code === 200){
						this.isShowdialog = true
						this.textVisible = false
					} else {
						this.$message.success(msg)
					}
				})
				.catch((err) => {
					reject(err)
				})
		},
		// 回收可用额度
		recycleCredLimitMethod() {
			this.isShowdialog = true
			this.recycleLimitVisible = false
			this.recycleStatus = 0
		},
		// 停用总代线，一键回收信用额度提交
		getGoogleKey(data) {
			this.googleVerifyCode = data
			this.isShowdialog = false
			this.textVisible = false
			this.loading = true
			this.$api
				.recoveringAvailableCreditLimitApi({
					googleVerifyCode: this.googleVerifyCode,
					userName: this.parentData.userName,
					merchantId: this.parentData.merchantId,
					proxyInfoRpcLiquidationReqDTO: {
						liquidationStatus: 1,
						loginLockStatus: 0,
						paymentLockStatus: 0,
						remark: '',
						recycleModel: this.recycleStatus // 回收可用额度: 0, 回收全部额度:  2
					}
				})
				.then(() => {
					this.$message.success('修改成功')
					this.isShowdialog = false
					this.loading = false
					this.recycleStatus = undefined
					this.receivedCreditLimitMethod()
				})
				.catch(() => {
					this.isShowdialog = false
					this.loading = false
					this.recycleStatus = undefined
				})
		},
		backPrevStep() {
			this.isShowdialog = false
		},
		// 回收信用额度方法
		receivedCreditLimitMethod() {
			this.loading = false
			this.disableOneKeyBtn = false
			this.editVisible = false
			this.$emit('basicInforFn')
		},
		getPolicyTypeArr() {
			this.rebateContract = []
			this.commissionContract = []
			this.$api
				.getProxyMinContractPolicyTypeList({ contractType: 1 })
				.then((res) => {
					if (res?.code === 200) {
						this.commissionContract = res?.data || []
						this.commissionContract.push({
							id: 0,
							policyType: this.$t('agent.custom')
						})
					} else {
						this.commissionContract = []
					}
				})
			this.$api
				.getProxyMinContractPolicyTypeList({ contractType: 2 })
				.then((res) => {
					if (res?.code === 200) {
						this.rebateContract = res?.data || []
						this.rebateContract.push({
							id: 0,
							policyType: this.$t('agent.custom')
						})
					} else {
						this.rebateContract = []
					}
				})
		},
		commissionPolicy(val) {
			if (val) {
				for (let i = 0; i < this.commissionContract.length; i++) {
					const obj = this.commissionContract[i]
					if (val * 1 === obj.id) {
						return obj.policyType
					}
				}
			} else {
				return '-'
			}
		},
		rebatePolicy(val) {
			if (val) {
				for (let i = 0; i < this.rebateContract.length; i++) {
					const obj = this.rebateContract[i]
					if (val * 1 === obj.id) {
						return obj.policyType
					}
				}
			} else {
				return '-'
			}
		},
		initGetDics() {
			const params = {}
			const merchantId = this.parentData.merchantId
			if (merchantId) {
				params.merchantId = merchantId
			}
			this.$api
				.getProxyLabelDict({ labelType: 1, ...params })
				.then((res) => {
					if (res?.code === 200) {
						// this.riskLevelList = res.data.windControl;
						this.memberLabelList = res.data || []
					}
				})
			this.$api
				.getSelectWindControlLevel({ windControlType: 2, ...params })
				.then((res) => {
					if (res?.code === 200) {
						this.riskLevelList = res.data || []

						const arr = this.riskLevelList.filter(
							(item) => item.id === this.editData.windControlId
						)
						if (arr.length === 0) {
							this.editData.windControlId = undefined
						}
					}
				})
			this.$api
				.getCreditLevelConfcreditList({ creditType: 2, ...params })
				.then((res) => {
					if (res.code === 200) {
						this.creditLevelList = res.data
					}
				})
			this.$api.getProxylevelnameList().then((res) => {
				if (res.code === 200) {
					this.proxyLevelList = res.data
				}
			})
		},
		// 会员详情-基本信息-概要信息以及个人资料
		getProxyDetailQueryDetail(val) {
			const merchantId = this.parentData.merchantId
			if (!merchantId) return
			this.$api
				.getProxyDetailQueryDetail({
					merchantId,
					userName: val.userName
				})
				.then((res) => {
					if (res?.code === 200) {
						this.outlineInfoList = res.data || {}
						this.withdrawDialog.withdrawLimitType = this.outlineInfoList.withdrawLimitType
						this.editData.proxyAffiliation = res?.data?.proxyAffiliation
						const newV = res.data || {}
						if (newV.auditList && newV.auditList !== null) {
							for (let i = 0; i < newV.auditList.length; i++) {
								const ele = newV.auditList[i]
								this.examineFlag.push(ele.applyType)
							}
						}
						this.getValidateKeyType(newV.checkType)
						const params = {
							userId: val.userId,
							pageNum: 1,
							pageSize: 100
						}
						this.$api.getProxyDetailRemark(params).then((res) => {
							if (res?.code === 200) {
								this.tableList = res.data?.record || []
								this.total = res.data?.totalRecord || 0
							}
						})
					}
					this.activeL = false
				})
		},
		async handleEditWithdrawLimitType() {
			try {
				this.loading = true
				await this.$api.setProxyDataInfoEdit({
					editWithdrawLimitType: {
						withdrawLimitType: this.withdrawDialog.withdrawLimitType
					},
					userName: this.parentData.userName,
					merchantId: this.parentData.merchantId
				})
				this.loading = false
				this.$message.success('修改成功')
				this.withdrawDialog.visible = false
			} catch (err) {
				throw err
			} finally {
				this.loading = false
			}
		},
		goOpenProxyReview() {
			this.$router.push({
				path: '/agent/agencyReview/openProxyReview',
				query: {
					eventId: this.eventId
				}
			})
			this.eventId = undefined
		},
		// 开启入口权限
		openProxyAudit(val) {
			const params = {
				...val,
				...val.entryAuthorityAfter,
				merchantName: this.outlineInfo.topMerchantName,
				userId: this.outlineInfo.id,
				applyRemark: val.entryAuthorityAfter.remark
			}
		},

		// 编辑信息
		setProxyDataInfoEdit(val) {
			// 处理入口权限
			if (this.moduleBox === this.$t('agent.entrance_role')) {
				return this.openProxyAudit(val)
			}

			this.$api
				.setProxyDataInfoEdit(val)
				.then((res) => {
					if (res?.code === 200) {
						const msg =
							(res.msg ||
								this.$t('agent.interface_exceptions')) ===
							'修改成功'
								? this.$t('common.modify_success')
								: res.msg ||
								  this.$t('agent.interface_exceptions')
						this.$message.success(msg)
						this.refresh()
						this.$refs.editForm.resetFields()
					}
					this.editVisible = false
				})
				.catch(() => {
					this.editVisible = false
				})
		},
		// 设置备注信息
		setProxyDetailRemark(data) {
			this.$api.setProxyDetailRemark(data).then((res) => {
				this.editVisible = false
				this.$message.success(this.$t('agent.remark_success'))
				if (res?.code === 200) {
					this.getProxyDetailRemark(this.parentData.id)
				}
			})
		},
		// 获取备注信息
		getProxyDetailRemark(val) {
			const params = {
				userId: val,
				pageNum: this.page,
				pageSize: this.size
			}
			this.$api.getProxyDetailRemark(params).then((res) => {
				if (res?.code === 200) {
					this.tableList = res.data?.record || []
					this.total = res.data?.totalRecord || 0
				}
			})
		},
		handelDayNum(val) {
			if (val) {
				const lastTime = dayjs(val)
				const nowTime = new Date()
				const day = dayjs(nowTime).diff(lastTime, 'day')
				return day
			} else {
				return '-'
			}
		},
		refresh() {
			this.activeL = true
			this.examineFlag = []
			const val = this.parentData
			this.getProxyDetailQueryDetail(val)
			this.queryLastMonthBalance()
		},
		editFn(val) {
			this.initGetDics()
			this.moduleBox = val
			this.isShowRemark = true
			this.editData.remark = ''
			this.titel = this.$t('agent.remark_info') + '：'
			switch (val) {
				case this.$t('agent.proxyGroup'):
					this.editData.groupId = this.outlineInfoList.groupName ?  this.outlineInfoList.groupId : undefined
					break
				case this.$t('common.account_status'):
					this.paymentLockStatus =
						this.outlineInfoList.paymentLockStatus === 0 ? 0 : 1
					this.loginLockStatus =
						this.outlineInfoList.loginLockStatus === 0 ? 0 : 1
					this.liquidation =
						this.outlineInfoList.liquidationStatus === 1 ||
						this.outlineInfoList.liquidationStatus === 2
							? 1
							: 0
					break
				case this.$t('common.risk_control_level'):
					this.editData.windControlId =
						parseInt(this.outlineInfoList.windControlId) === 0
							? undefined
							: this.outlineInfoList.windControlId + ''
					for (let i = 0; i < this.riskLevelList.length; i++) {
						const ele = this.riskLevelList[i]
						if (this.editData.windControlId === ele.id) {
							this.editData.windControlName =
								ele.windControlLevelName
						}
					}
					break
				case this.$t('agent.agent_label'):
					this.editData.labelId =
						parseInt(this.outlineInfoList.labelId) === 0
							? undefined
							: this.outlineInfoList.labelId + ''
					for (let i = 0; i < this.memberLabelList.length; i++) {
						const ele = this.memberLabelList[i]
						if (this.editData.labelId === ele.id) {
							this.editData.labelName = ele.labelName
						}
					}
					break
				case this.$t('agent.entrance_role'):
					this.editData.entryAuthority = '1'
					this.editData.parentProxyName = this.outlineInfoList.parentProxyName
					break
				case this.$t('agent.pay_password_reset'):
					this.titel = this.$t('agent.audit_remark')
					break
				case this.$t('agent.forced_edit_contract_effect'):
					this.editData.mandatoryContract =
						this.outlineInfoList.enforceContractStatus + ''
					break
				case this.$t('agent.credit_level'):
					this.editData.creditLevel = this.outlineInfoList.creditLevel
					break
				case this.$t('agent.agent_level_limit'):
					this.editData.maxLevel = this.outlineInfoList.maxLevel
					this.titel = this.$t('agent.submit_remark')
					break
				case this.$t('agent.profit_policy_adjust'):
					this.editData.sharingPolicyId = this.outlineInfoList.sharingPolicyId
					this.titel = this.$t('agent.submit_remark')
					break
				case this.$t('member.login_password_reset'):
					this.titel = this.$t('agent.submit_remark') + ':'
					this.resetPassword = ''
					this.setRandomPassword(8)
					break
				case this.$t('agent.top_proxy_belong'):
					this.isShowRemark = false
					this.moduleBox = this.$t('agent.edit_top_proxy_belong')
					break
				case this.withdrawDialog.title:
					this.withdrawDialog.visible = true
					break
				case this.$t('routes.system.manage'):
					this.isShowRemark = false
					this.titel = this.$t('routes.system.manage')
					this.editData.crossOptLevel =
						this.outlineInfoList.crossOptLevel === 1
					this.editData.playerToProxy =
						this.outlineInfoList.playerToProxy === 1
					this.editData.rolloverMultipleConfig =
            			this.outlineInfoList.rolloverMultipleConfig === 1
					break
				case this.$t('agent.check_title'):
					this.editData.checkType = this.outlineInfoList.checkType
					break
				default:
					this.titel = this.$t('agent.remark_info') + ':'
					break
			}
			this.editVisible = true
		},
		changeWindControlId(val) {
			this.editData.windControlId = val
			for (let i = 0; i < this.riskLevelList.length; i++) {
				const ele = this.riskLevelList[i]
				if (ele.id === val) {
					this.editData.windControlName = ele.windControlLevelName
				}
			}
		},
		changeLabelId(val) {
			for (let i = 0; i < this.memberLabelList.length; i++) {
				const ele = this.memberLabelList[i]
				if (ele.id === val) {
					this.editData.labelName = ele.labelName
				}
			}
		},
		changeEntrAuthorityType(val) {
			// this.editData.entryAuthority = val;
		},
		cancel() {
			this.$refs.editForm.resetFields()
			this.editVisible = false
		},
		submitEdit() {
			const params = this.editData
			const data = {}
			data.userName = this.parentData.userName
			data.merchantId = this.parentData.merchantId
			this.$refs.editForm.validate((valid) => {
				if (valid) {
					const loading = this.$loading({
						lock: true,
						text: 'Loading',
						spinner: 'el-icon-loading',
						background: 'rgba(0, 0, 0, 0.7)'
					})
					switch (this.moduleBox) {
						case this.$t('common.account_status'):
							data.accountStatusAfter = {
								loginLockStatus: this.loginLockStatus,
								paymentLockStatus: this.paymentLockStatus,
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('common.risk_control_level'):
							data.windControlAfter = {
								windControlId: params.windControlId,
								windControlName: params.windControlName,
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.agent_label'):
							data.labelAfter = {
								labelId: params.labelId,
								labelName: params.labelName,
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.account_remark'):
							data.remark = params.remark
							data.merchantId = this.parentData.merchantId
							data.userId = this.parentData.userId
							data.userName = this.parentData.userName
							this.setProxyDetailRemark(data)
							loading.close()
							break
						case this.$t('agent.forced_edit_contract_effect'):
							data.mandatoryContractAfter = {
								mandatoryContract: params.mandatoryContract,
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.entrance_role'):
							data.entryAuthorityAfter = {
								entryAuthority: params.entryAuthority,
								parentProxyName: params.parentProxyName,
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.pay_password_reset'):
							data.payPasswordAfter = {
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.credit_level'):
							data.creditLevelAfter = {
								creditLevel: params.creditLevel,
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.agent_level_limit'):
							data.maxLevelsAfter = {
								maxLevels: params.maxLevel,
								remark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.login_password_reset'):
							data.resetPwdAfter = {
								newPassword: this.resetPassword,
								resetPwdRemark: params.remark
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.private_bank_upgrade'):
							data.bankerModeAfter = {
								bankerMode: 2,
								remark: params.remark
								// sharingPolicyId: params.sharingPolicyId
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.profit_policy_adjust'):
							data.sharingPolicyAfter = {
								remark: params.remark,
								sharingPolicyId: params.sharingPolicyId
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.edit_top_proxy_belong'):
							data.proxyAffiliationAfter = {
								proxyAffiliation: params.proxyAffiliation,
								type: 9
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.withdrawDialog.title:
							data.sharingPolicyAfter = {
								remark: params.remark,
								sharingPolicyId: params.sharingPolicyId
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('routes.system.manage'):
							data.proxyInfoRpcPermissionReqDTO = {
								crossOptLevel: params.crossOptLevel ? 1 : 0,
								playerToProxy: params.playerToProxy ? 1 : 0,
								rolloverMultipleConfig: params.rolloverMultipleConfig ? 1 : 0
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						case this.$t('agent.check_title'):
							this.handleResetKey()
							loading.close()
							break
						case this.$t('agent.proxyGroup'):
							data.groupInfoDTO = {
								remark: params.remark,
								groupId: params.groupId
							}
							this.setProxyDataInfoEdit(data)
							loading.close()
							break
						default:
							break
					}
				} else {
					return false
				}
			})
		},
		closeFormDialog() {
			if (
				this.moduleBox !== this.$t('member.login_password_reset') &&
				this.moduleBox !== this.$t('routes.system.manage')
			) {
				this.$refs.editForm.resetFields()
			}
			this.$refs.editForm.clearValidate()
			// setTimeout(() => {
			this.editVisible = false
			// }, 0);
		},
		handleCurrentChange(val) {
			this.page = val
			if (this.parentData.userId !== null) {
				this.getProxyDetailRemark(this.parentData.userId)
			}
		},
		handleSizeChange(val) {
			this.page = 1
			this.size = val
			if (this.parentData.userId !== null) {
				this.getProxyDetailRemark(this.parentData.userId)
			}
		},
		// 打开佣金弹窗
		openPolicyTypeDialog(type) {
			this.policyTypeDialog.visible = true
			this.policyTypeDialog.editData = Object.assign(
				{},
				this.outlineInfoList
			)
			this.policyTypeDialog.editData.signProxyName = this.policyTypeDialog.editData.userName
			this.policyTypeDialog.editData.contractType = [type]
			this.policyTypeDialog.editData.merchantId = this.outlineInfoList.merchantId
			this.policyTypeDialog.editData.signProxyLevel = this.outlineInfoList.proxyLevel
			//  总代修改政策类型, 不需要旧的政策id

			this.policyTypeDialog.editData.oldCommissionPolicyTypeId = this.policyTypeDialog.editData.commissionPolicyTypeId
			this.policyTypeDialog.editData.oldRebatePolicyTypeId = this.policyTypeDialog.editData.rebatePolicyTypeId
			this.policyTypeDialog.editData.commissionPolicyTypeId = undefined
			this.policyTypeDialog.editData.rebatePolicyTypeId = undefined
		},
		// 政策类型下拉选择
		handleCommand(type) {
			this.openPolicyTypeDialog(type)
		},
		// 组件契约类型选项
		getContractTypeArr() {
			const arr = []
			if (this.outlineInfoList.commissionContractId !== '0') {
				arr.push({
					title: this.$t('agent.commission_policy_type'),
					value: 1
				})
			}
			if (this.outlineInfoList.rebateContractId !== '0') {
				arr.push({
					title: this.$t('agent.rebate_policy_type'),
					value: 2
				})
			}
			return arr
		},
		// 关闭政策编辑弹窗时的方法
		onContractEditOrCreateDialogClose() {
			this.policyTypeDialog.visible = false
			this.policyTypeDialog.editData = {}
			this.refresh()
		},
		async getValidateKeyType(checkType) {
			if (checkType === 1) {
				this.checkTypeStr = this.$t('common.google_key')
				// await this.$api
				// 	.getSystemValidateKeyType()
				// 	.then((res) => {
				// 		const validateKeyType = res?.data?.verifyCodeType || 1
				// 		if (validateKeyType === 3) {
				// 			// 海月盾密钥
				// 			this.checkTypeStr = this.$t('common.seamoon_key')
				// 		} else {
				// 			// 谷歌密钥
				// 			this.checkTypeStr = this.$t('common.google_key')
				// 		}
				// 	})
				// .catch(() => {})
			} else {
				this.checkTypeStr = '无校验'
			}
		},
		handleResetKey(bool) {
			this.isResetGoogelKey = !!bool
			if (bool || (this.editData.checkType === 0 &&  this.outlineInfoList.checkType > 0)) {
				this.isShowdialog = true
				this.editVisible = false
			} else if (this.editData.checkType === this.outlineInfoList.checkType  ){
				this.isShowdialog = false
				this.editVisible = false
				this.$message.success('修改成功')
			}else {
				this.updateCheckKey()
				this.editVisible = false
			}
		},
		updateCheckKey(code) {
			if (this.isResetGoogelKey) {
				this.$api.proxyDataResetProxyCheckType({
					googleVerifyCode: code,
					proxyId: this.outlineInfo.id
				}).then(res => {
					if (res?.code === 200) {
						this.$message.success('操作成功')
					}
				})

			} else {
				this.setProxyDataInfoEdit({
					googleVerifyCode: code,
					userName: this.outlineInfo.userName,
					merchantId: this.outlineInfo.merchantId,
					proxyInfoRpcEditCheckType: {
						checkType: this.editData.checkType,
						remark: this.editData.remark
					}
				})
			}

			this.backPrevStep()
		}
	}
}
</script>

<style lang="scss" scoped>
.withdraw-form {
	p {
		font-size: 13px;
		margin-top: 5px;
		color: #666;
		padding-left: 20px;
		margin-bottom: 40px;
	}
}
.withdraw {
	padding: 20px;
	padding-top: 0;
	.info {
		color: red;
		margin-bottom: 40px;
	}
}
#basicInformation {
	font-size: 14px;
	padding-top: 10px;
	// padding-bottom: 40px;
}
::v-deep .el-dialog__header {
	color: #909399;
	font-weight: 700;
}
.dialog-footer {
	text-align: center;
}
.maxWidth {
	::v-deep .el-form-item__label {
		width: 140px !important;
	}
	::v-deep .el-form-item__content {
		margin-left: 140px !important;
	}
}
.titelBox {
	font-size: 16px;
	line-height: 40px;
	font-weight: bold;
	position: relative;
}
.backgroundTitelBox {
	width: 188px;
	text-align: center;
	background: #000;
	color: rgb(255, 255, 255);
}
.refrestBox {
	text-align: center;
	border-right: 1px solid #ccc;
	margin: 0 10px;
}
.editMsg {
	text-align: center;
	line-height: 18px;
	i {
		font-size: 18px;
		font-weight: bold;
		margin-bottom: 5px;
	}
}
.btngroup button {
	height: 20px;
	line-height: 18px;
	padding: 0 5px;
	margin: 0;
}
.msgList {
	margin-bottom: 10px;
	::v-deep .el-col {
		min-height: 24px;
	}
	strong {
		font-weight: normal;
	}
}
.borderL {
	position: absolute;
	right: 0;
	height: 130px;
	border-left: 1px solid #ccc;
}
.textR {
	text-align: right;
}
.paddingBox {
	padding: 0 30px;
}
.paddingL {
	padding-left: 30px;
}
.textC {
	text-align: center;
}
.clear {
	clear: both;
	height: 0;
	line-height: 0;
	font-size: 0;
}
.noDrop {
	cursor: no-drop;
}
// 契约政策弹窗样式
::v-deep .policy-type-dialog {
	.el-dialog__body {
		padding: 0px 20px;
	}
	.el-dialog__header {
		display: flex;
		height: 60px;
		align-items: center;
		justify-content: space-between;
		padding: 20px;
		background-color: #000;
	}
}

.vi_VN,
.en_US,
.th_TH {
	.maxWidth {
		::v-deep .el-form-item__label {
			width: 178px !important;
			margin: 0 !important;
		}

		::v-deep.el-form-item__label-wrap {
			margin: 0 !important;
		}
		::v-deep .el-form-item__content {
			margin-left: 178px !important;
		}
	}
}
.textContent{
	margin-bottom: 35px;
	strong{
		font-weight: normal;
		color:#f56c6c
	}
}
</style>
